package com.yunfeisoft.business.service.impl;

import com.applet.base.BaseServiceImpl;
import com.yunfeisoft.business.dao.inter.CmsSubjectCommentDao;
import com.yunfeisoft.business.model.CmsSubjectComment;
import com.yunfeisoft.business.service.inter.CmsSubjectCommentService;
import com.applet.sql.separation.DataSourceChange;
import com.applet.utils.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: CmsSubjectCommentServiceImpl
 * Description: 专题评论表service实现
 * Author: Jackie liu
 * Date: 2020-06-02
 */
@Service("cmsSubjectCommentService")
public class CmsSubjectCommentServiceImpl extends BaseServiceImpl<CmsSubjectComment, String, CmsSubjectCommentDao> implements CmsSubjectCommentService {

    @Override
    @DataSourceChange(slave = true)
    public Page<CmsSubjectComment> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int modifyShowStatus(String id, int showStatus) {
        if (StringUtils.isBlank(id)) {
            return 0;
        }

        CmsSubjectComment comment = new CmsSubjectComment();
        comment.setId(id);
        comment.setShowStatus(showStatus);
        return getDao().update(comment);
    }
}